package com.trkj.dao.jpa;

import java.math.BigDecimal;

import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;

import com.trkj.pojos.DrugstorageHasdrug;

public interface IStorageHasDrugsDAO extends CrudRepository<DrugstorageHasdrug, Long> {
		//根据药品名称查询正常库存
		@Query("select a.medcineNumber from DrugstorageHasdrug a where a.medcineDetail.medcineName=?1")
		public BigDecimal findOneDrugsNumber(String medcineName);
		//根据药品名找到药库拥有药品记录
		@Query("select new DrugstorageHasdrug(d.drugstorageDrughasdrugsId,d.medcineNumber,d.medcineStock) from DrugstorageHasdrug d where d.medcineDetail.medcineName=?1")
		public DrugstorageHasdrug findDrugstorageHasdrugByName(String medcineName);
}
